package com.example.msg.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitmqConfig {
    @Bean
    public Queue createQueue2(){
        return QueueBuilder.durable("msg_queue").build();
    }

    //创建交换机
    @Bean
    public DirectExchange createOrderExchange(){
        return new DirectExchange("msg.exchange");
    }

    @Bean
    public Binding createBindingdel(){
        return BindingBuilder.bind(createQueue2()).to(createOrderExchange()).with("order.routing.key");
    }
}
